package cn.bdqn.service.impl;

import cn.bdqn.mapper.SysJobPoMapper;
import cn.bdqn.pojo.SysJobPo;
import cn.bdqn.service.SysJobPoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysJobPoServiceImpl implements SysJobPoService {

    @Resource
    private SysJobPoMapper sysJobPoMapper;

    @Override
    public int add(SysJobPo sysJobPO) {
        return sysJobPoMapper.insert(sysJobPO);
    }

    @Override
    public int edit(SysJobPo sysJobPo) {
        return sysJobPoMapper.updateById(sysJobPo);
    }

    @Override
    public List<SysJobPo> getByStatus(Integer status) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("job_status",status);
        return sysJobPoMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysJobPo> getAll() {
        return sysJobPoMapper.selectList(null);
    }

    @Override
    public SysJobPo getById(Integer jobId) {
        return sysJobPoMapper.selectById(jobId);
    }

    @Override
    public int del(Integer jobId) {
        return sysJobPoMapper.deleteById(jobId);
    }

}
